//
//  HYCustonSearchBar.m
//  TJHYHardwareProduct
//
//  Created by Kendama on 2018/1/23.
//  Copyright © 2018年 Kendama. All rights reserved.
//

#import "HYCustonSearchBar.h"

@implementation HYCustonSearchBar

- (UIImageView *)iconImageView
{
    if(!_iconImageView)
    {
        UIView *superView = self;
        _iconImageView = [[UIImageView alloc]init];
        [superView addSubview:_iconImageView];
        _iconImageView.image = [UIImage imageNamed:@"nav_lookup"];
    }
    return _iconImageView;
}
- (UITextField *)searchTextField
{
    if(!_searchTextField)
    {
        UIView *superView = self;
        _searchTextField = [[UITextField alloc]init];
        [superView addSubview:_searchTextField];
    }
    return _searchTextField;
}

- (void)masLayoutSubview
{
    self.backgroundColor = [UIColor redColor];
    __weak UIView *superView = self;
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superView.mas_centerY);
        make.left.mas_equalTo(superView.mas_left).with.offset(px1080Width(26));
        make.height.width.mas_equalTo(px1920Height(43));
    }];
    
    [self.searchTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superView.mas_centerY);
        make.left.mas_equalTo(_iconImageView.mas_right).with.offset(px1080Width(30));
        make.right.mas_equalTo(superView.mas_right);
    }];
}


@end
